﻿@using X.PagedList;
@using X.PagedList.Mvc.Core;
@using X.PagedList.Mvc.Common;
@using FwProject.Settlement.Dto
@using FwProject.Core.SettlementInfoModel
@model IPagedList<SettlementInfoDto>
@{
    Layout = null;

}
<div id="table_print" style="max-height:600px;overflow-y:scroll;">
    <table id="t" class="table table-bordered table-hover table-rowselected">
        <thead>
            <tr>
                <th style="text-align:center;width: 40px;">
                    <div class="i-checks" id="chkDiv">
                        <label class="ibox-tools" id="latd1">
                            <input type="checkbox" id="che" value="">
                        </label>
                    </div>
                </th>
                <th>收/退款员</th>
                <th>收款状态</th>
                <th>开单日期</th>
                <th>单号</th>
                <th>餐厅名称</th>
                <th>配送日期</th>
                <th>配送应收金额</th>
                <th>制单优惠金额</th>
                <th>制单收款金额</th>
            </tr>
        </thead>
        <tbody>
            @if (Model.Count == 0)
            {
                <tr><td class="text-center" colspan="10">暂无可分配收据信息</td></tr>
            }
            else
            {
                var Discountprice = 0.0m;
                var Totalprice = 0.0m;
                var Actualprice = 0.0m;
                foreach (var item in Model)
                {
                    Discountprice += item.Discountprice;
                    Totalprice += item.Totalprice;
                    Actualprice += item.Actualprice;
                    <tr>
                        <td style="text-align:center">
                            <div class="i-checks" data-value="@item.Id">
                                <input type="checkbox" name="che" value="@item.Id"> <i></i>
                            </div>
                        </td>
                        <td>@(item.EmployeeDriverDao != null ? item.EmployeeDriverDao.Name : "")</td>
                        <td>@item.RestaurantPayStatus</td>
                        <td>@item.CreationTime.ToString("yyyy-MM-dd")</td>
                        <td><a href="javascript:top.window.openTab(1112,'收据[@item.CreationNumber]','/Receipt/SettlementDetails?id=@item.Id')">@item.CreationNumber</a></td>
                        <td>@(item.RestaurantInfoModel != null ? item.RestaurantInfoModel.RestaurantName : "")</td>
                        <td>@item.DeliveryDate</td>
                        <td>@item.Totalprice</td>
                        <td>@item.Discountprice</td>
                        <td>@item.Actualprice</td>
                    </tr>
                }
                <tr class="footer">
                    <td colspan="2" style="color:red;text-align:center">合计</td>
                    <td colspan="5"></td>
                    <td style="color:red">@Totalprice</td>
                    <td style="color:red">@Discountprice</td>
                    <td style="color:red">@Actualprice</td>
                </tr>
            }
        </tbody>
    </table>

</div>
<div class="row pagedinfo">
    <div class="col-sm-5">
        共 @Model.TotalItemCount 条，
        <select class="form-control" id="pageSize" style="width:70px;display:initial">
            @for (int z = 10; z < 100; z = z + 10)
            {
                if (z == Model.PageSize)
                {
                    <option selected value="@z">@z</option>
                }
                else
                {
                    <option value="@z">@z</option>
                }
            }
        </select> &nbsp;条/页 当前第 @Model.PageNumber/@Model.PageCount 页
    </div>
    <div class="col-sm-7">
        <input type="hidden" id="pageurl" value="&beginTime=@(Context.Request.Query["beginTime"])&endTime=@(Context.Request.Query["endTime"])" />
        @Html.PagedListPager(Model, page => Url.Action("AssignReceipt", new { pageIdx = page, size = Context.Request.Query["size"], beginTime = Context.Request.Query["beginTime"], endTime = Context.Request.Query["endTime"] }), PagedListRenderOptions.EnableUnobtrusiveAjaxReplacing(new AjaxOptions() { AllowCache = false, HttpMethod = "Get", UpdateTargetId = "data_list", OnSuccess = "AjaxSuccessCallback", OnBegin = "AjaxBegin" }))
    </div>
</div>

